ActiveReports Developer 7
Using the WPF Viewer
See Also Support Forum
ActiveReports Developer 7 > ActiveReports Developer Guide > Getting Started > Viewing Reports > Using the WPF Viewer

Glossary Item Box

ActiveReports provides the WPF Viewer that you can use to load and view your reports. This viewer contains a toolbar and a sidebar with Thumbnails, Search results, Document map and Parameters panes.

ShowWPF Viewer Toolbar

The following table lists the actions you can perform through the WPF Viewer toolbar.

Toolbar Element Name Description
Toggle sidebar Displays the sidebar that includes the Thumbnails, Parameters, Document map and Search results panes.
Print Displays the Print dialog where you can specify the printing options.
Copy Copies text that you select in the Selection mode to the clipboard.
Note: In case the GrapeCity.ActiveReports.Export.Xml.v7.dll and GrapeCity.ActiveReports.Export.Word.v7.dll are not available in GAC, you might need to add references to these assembly files to enable the viewer's Copy button.
Find Displays the Find dialog to find any text in the report.
Zoom out Decreases the magnification of your report.
Current zoom Displays the current zoom percentage which can also be edited.
Zoom in Increases the magnification of your report.
Fit width Fits the width of the page according to viewer dimensions.
Fit page Fits the whole page within the current viewer dimensions.
First page Takes you to the first page of the report. This button is enabled when a page other than the first page is open.
Last page Takes you to the last page of the report. This button is disabled on reaching the last page of the report.
Previous page Takes you to the page prior to the current page. This button is enabled when a page other than the first page is open.
Next page Takes you to the page following the current page. This button is disabled on reaching the last page of the report.
Current page Opens a specific page in the report. To view a specific page, type the page number and press the Enter key.
Backward Takes you to the last viewed page. This button is enabled when you move to any page from the initial report page. Clicking this button for the first time also enables the Forward button.
Forward Takes you to last viewed page before you clicked the Backward button. This button is enabled once you click the Backward button.
Back to parent report Returns you to the parent report in a drillthrough report.
Refresh Refreshes the report.
Cancel Cancels the report rendering.
Pan mode A hand serves as the pointer that you can use to navigate the report.
Selection mode Allows you to select contents on the report. Click the Copy icon (see image and description below) to copy the selected content to the clipboard.
Snapshot mode Allows you to select content on the report that you can paste as an image into any application that accepts pasted images.

ShowWPF Viewer Sidebar

The WPF Viewer sidebar appears on the left of the Viewer control when you click the Toggle sidebar button in the toolbar. By default, this sidebar shows the Thumbnails and Search Results panes. The additional Document map and Parameters also appear in this sidebar. You can toggle between any of the viewer panes by clicking the buttons for each pane at the bottom of the sidebar.

ShowThumbnails pane

The Thumbnails pane appears by default in the sidebar when you click the Toggle sidebar button in the toolbar.

This pane comprises of a thumbnail view of all the pages in a report. Click any thumbnail to navigate directly to the selected report page. You can also modify the size of the thumbnail when you click (+) or (-) button to zoom in and zoom out.


ShowSearch results pane

The Search pane is the other default pane besides Thumbnails that appears in the sidebar when you click the Toggle sidebar button. This pane lets you enter a word or phrase from which to search within the report.


To search in a report:

  • Enter the word or phrase in the search field.
  • Under Use these additional criteria, you may optionally choose to search for the whole word or match the case of the search string while searching in the report.
  • Click the Search button to see the results appear in the Find results list.
  • Click an item in the list to jump to that item in the report and highlight it.

To start a new search or clear the current search results, click the Clear button under the Find results list.

ShowDocument map pane

The Documents map pane is enabled for reports where the Label property or the Document map label is set. This pane displays each value for the text box, group, or sub report that you label, and you can click them to navigate to the corresponding area of the report in the Viewer.


 

If a report does not have the Label property or Document map label set, the Documents map pane does not appear in the sidebar.

ShowParameters pane

The WPF Viewer allows you to view reports with parameters. In the toolbar, click the Toggle sidebar button to open the WPF Viewer sidebar and if your report contains parameters, the Parameters pane shows up automatically.


  1. In the Parameters pane, you are prompted to enter a value by which to filter the data to display.
  2. Enter a value or set of values and click View report, to filter the report data and display the report.

If a report does not have parameters, the Parameters pane does not appear in the sidebar.

Display the report in the WPF Viewer

Set up your WPF Application project by using the following steps.

  1. Create a new WPF Application project or open an existing one. 
  2. For a new project, in the Visual Studio Solution Explorer, right-click YourProject and select Add, then New Item.
  3. In the Add New Item dialog that appears, select the ActiveReports 7 Page Report, ActiveReports 7 Section Report (code-based) or ActiveReports 7 Section Report (xml-based). This adds the necessary references to your project.
  4. From the Toolbox ActiveReports 7 tab, drag the Viewer control and drop it on the design view of MainWindow.xaml.
  5. In the Solution Explorer, right-click YourProject and select Add, then Existing Item and select an existing report to load in the viewer.
  6. In the Properties window, with the report selected, set Copy to Output Directory to Copy Always.
  7. On MainWindow.xaml, with the viewer selected, go to the Properties window and double click the Loaded event.
  8. In the MainWindow code view that appears, add code like the following to the viewer1_loaded event to bind the report to the viewer.  Each of these code snippets presumes a report in the project of the type indicated with the default name. (If you have renamed your report, you need to rename it in the code as well). 
    Note: Refer to LoadDocument method to see other ways to load a report in WPF Viewer.

    ShowTo write the code in Visual Basic.NET

    The following example demonstrates how you display a page report in the WPF Viewer control.

    Visual Basic.NET code. Paste INSIDE the viewer1_Loaded event in MainWindow.xaml.vb. Copy Code
    Viewer1.LoadDocument("YourReportName.rdlx")
    

    The following example demonstrates how you can display a section report (code-based) in the WPF Viewer control.

    Visual Basic.NET code. Paste INSIDE the viewer1_Loaded event in MainWindow.xaml.vb. Copy Code
    viewer1.LoadDocument(new YourReportName())
    

    The following example demonstrates how you can display a section report (xml-based) in the WPF Viewer control.

    Visual Basic.NET code. Paste INSIDE the viewer1_Loaded event in MainWindow.xaml.vb. Copy Code
    Viewer1.LoadDocument("YourReportName.rpx")
    

    ShowTo write the code in C#

    The following example demonstrates how you display a page report in the WPF Viewer control.

    C# code. Paste INSIDE the viewer1_Loaded event in MainWindow.xaml.cs. Copy Code
    viewer1.LoadDocument("YourReportName.rdlx");
    

    The following example demonstrates how you can display a section report (code-based) in the WPF Viewer control.

    C# code. Paste INSIDE the viewer1_Loaded event in MainWindow.xaml.cs. Copy Code
    viewer1.LoadDocument(new YourReportName());
    

    The following example demonstrates how you can display a section report (xml-based) in the WPF Viewer control.

    C# code. Paste INSIDE the viewer1_Loaded event in MainWindow.xaml.cs. Copy Code
    viewer1.LoadDocument("YourReportName.rpx");
    

Additional Features

Following is an introduction to the additional capabilities of the Viewer to guide you on using it effectively.

ShowAnnotations Toolbar

You can use annotations when working with a report in the WPF Viewer and add notes, special instructions or images directly to the reports.

Annotations are added via the WPF Viewer's toolbar, which is hidden by default. You can make the Annotations toolbar available by setting the AnnotationDropDownVisible property to true in the viewer's properties grid.

Annotation Name Description
AnnotationText A rectangular box in which you can enter text.
AnnotationCircle A circle without text. You can change the shape to an oval.
AnnotationRectangle A rectangular box without text.
AnnotationArrow A 2D arrow in which you can enter text. You can change the arrow direction.
AnnotationBalloon A balloon caption in which you can enter text. You can point the balloon's tail in any direction.
AnnotationLine A line with text above or below it. You can add arrow caps to one or both ends and select different dash styles.
AnnotationImage A rectangle with a background image and text. You can select an image and its position, and place text on the image.

ShowKeyboard Shortcuts

The following shortcuts are available on the WPF Viewer.

Keyboard Shortcut Action
Ctrl + F Shows the find dialog.
Ctrl + P Shows the print dialog.
Esc Closes the find or print dialogs.
Page Down Moves to the next page.
Page Up Moves to the previous page.
Ctrl + T Shows or hides the table of contents.
Ctrl + Home Moves to the first page.
Ctrl + End Moves to the last page.
Ctrl + Right Navigates forward.
Ctrl + Left Navigates backward.
Ctrl + - Zooms out.
Ctrl + + Zooms in.
Left, Right, Up, Down Moves the visible area of the page in the corresponding direction.
Ctrl + 0 (zero) Sets the zoom level to 100%.
Ctrl + rotate mouse wheel Changes the zoom level up or down.
Ctrl + M Turns on the continuous view.
Ctrl + S Turns off the continuous view.
F5 Refreshes the report.

See Also

Walkthroughs
WPF Viewer

©2014. ComponentOne, a division of GrapeCity. All rights reserved.